--[[------------------------------------------------------------
-- Initializes the Main Menu GUI
-- The engine kicks off this script when it boots up.
-- NOTE: To change the MainMenu script, simply change
-- 'g_menu_script' cvar to point to another file.
--
-- Author: Tony Sparks
-- Date: 2-15-07
--]]------------------------------------------------------------ 

-- Our global label, only create one instance
console.Exec( "load game01.zip" );

--[[
	Set label properties
	Our background
--]]

panel		= GUI_Panel:new();
panel:Create("panel", "");
panel:SetSize( 400, 200 );
panel:SetLocation( 200, 200 );
panel:SetBackgroundColor( 0,0,0 );
--panel:SetAlpha( 0.4 );
--panel:SetForegroundColor( 0,0,0 );
--panel:AddBackgroundImage( "misc/rain1.tga" );
--panel:AddBackgroundImage( "misc/rain2.tga" );
--panel:AddBackgroundImage( "misc/rain3.tga" );
--panel:AddBackgroundImage( "misc/rain4.tga" );
--panel:SetFPS( 100 );
--panel:SetVisible(1);

--[[
	The Start Button
	
	The start button kicks off the game_init.lua
	script which loads all the necessary things for
	the game to startup
--]]
buttonStartGame		= GUI_Button:new("start_button","panel");
buttonStartGame:SetBackgroundImage( "misc/newGameButton.tga", 100, 1, 1, 1 );
buttonStartGame:SetHoverImage( "misc/highlitedButton.tga", 100, 1, 1, 1 );
buttonStartGame:SetSize( 256, 64 );
buttonStartGame:SetLocation( 240, 100 );
buttonStartGame:SetBackgroundColor( 0,0,0 ); --0.29, 0.19, 0.18 );
buttonStartGame:SetAlpha( 0.4 );
buttonStartGame:SetForegroundColor( 1,1,1 );
--buttonStartGame:SetText( "Start Game.");
buttonStartGame:SetOnClick( "StartGame" );
buttonStartGame:SetVisible( 1 );

--[[
	Start the Game
--]]
function StartGame()
	FinishMenuState();
	dofile( "game_init.lua" );
end

--[[ 
	Call this function when leaving the menu state
--]]

function FinishMenuState()
	panel:Destroy();
	buttonStartGame:Destroy();
	
	gameState.PopState(0);
end

console.Exec("echo Constructed the main menu!" );
